home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / HardDisk / HardBlocks < prev    next >
Encoding:
Text File  |  1992-08-27  |  15.4 KB  |  387 lines

  1.  
  2. HardBlocks specification  03/89
  3.  
  4. * Copyright 1988 Commodore-Amiga, Inc.   All Rights Reserved
  5. *  
  6. * This information is provided "as is"; no warranties are made.  All 
  7. * use is at your own risk. No liability or responsibility is assumed.
  8.  
  9.  
  10. hardblocks.h
  11.  
  12. This file describes blocks of data that exist on a hard disk
  13. to describe that disk.  They are not generically accessable to
  14. the user as they do not appear on any DOS drive.  The blocks
  15. are tagged with a unique identifier, checksummed, and linked
  16. together.
  17.  
  18. The four block types currently defined are RigidDiskBlock,
  19. BadBlockBlock, PartitionBlock, FileSysHeaderBlock, and
  20. LoadSegBlock.
  21.  
  22. The root of these blocks is the RigidDiskBlock.
  23. The RigidDiskBlock must exist on the disk within the first
  24. RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  25. cylinder in an AmigaDOS partition: although it is strictly
  26. possible to store the RigidDiskBlock data in the reserved
  27. area of a partition, this practice is discouraged since the
  28. reserved blocks of a partition are overwritten by "Format",
  29. "Install", "DiskCopy", etc.  The recommended disk layout,
  30. then, is to use the first cylinder(s) to store all the drive
  31. data specified by these blocks: i.e. partition descriptions,
  32. file system load images, drive bad block maps, spare blocks,
  33. etc.  This allocation range is described in the RigidDiskBlock.
  34.  
  35. The RigidDiskBlock points to bad block, partition, file system
  36. and drive initialization description blocks.  The bad block
  37. format is simply lists of pairs describing bad blocks and their
  38. replacements.
  39.  
  40. The drive initialization description blocks are LoadSegBlock
  41. blocks that are loaded at boot time to perform drive-specific
  42. initialization when called with parameters both "C" style on
  43. the stack, and in assembler registers as follows:
  44.     d0 = DriveInit(lun,rdb,ior)(d0/a0/a1)
  45. where lun is the SCSI logical unit number (needed to construct
  46. SCSI commands), rdb is an image of the RigidDiskBlock and
  47. cannot be altered, and ior is a standard IO request block that
  48. can be used to access the drive with synchronous DoIO() calls.
  49. The result of DriveInit is either -1, 0, or 1.  -1 reports an
  50. error occurred and drive initialization cannot continue, zero
  51. reports success.  In both cases, the code is unloaded.  1
  52. reports success, and causes the code to be kept loaded.
  53. Furthermore, this resident code is to be called whenever a 
  54. reset is detectected on the SCSI bus.
  55.  
  56.  
  57. The FileSysHeaderBlock entries contain code for alternate
  58. file handlers to be used by partitions that specify them.
  59. There are several strategies that can be used to determine
  60. which of them to load.  The most robust would scan all drives
  61. for those that are both required by partitions and have the
  62. highest fhb_Version, and load those.  Whatever method is used,
  63. the loaded file handlers are added to the exec resource
  64. FileSystem.resource, where they are used as needed to mount
  65. disk partitions.
  66.  
  67. The PartitionBlock entries contains most of the data necessary
  68. to add each device to the system.  They replace the Mount &
  69. DEVS:MountList mechanism for adding these devices.  The only
  70. items required by the expansion.library MakeDosNode function
  71. which are not in this partition block are the exec device
  72. name and unit, which is expected to be known by the reader of
  73. the block.  The file system to be used is specified in the
  74. pb_Environment.  If it is not the default file system (i.e.
  75. 'DOS\0'), the node created by MakeDosNode is modified as
  76. specified in a FileSystem.resource's FileSysEntry before adding
  77. it to the dos list.
  78.  
  79. Though only 512 byte blocks are currently supported by the
  80. file system, this proposal tries to be forward-looking by
  81. making the block size explicit, and by using only the first
  82. 256 bytes for all blocks but the LoadSeg data.
  83.  
  84.  
  85.     RigidDiskBlock
  86.     rdb_ID            == 'RDSK'
  87.     rdb_SummedLongs        == 64
  88.     rdb_ChkSum        block checksum (longword sum to zero)
  89.     rdb_HostID        SCSI Target ID of host
  90.                 This is the initiator ID of the creator of this
  91.                 RigidDiskBlock.  It is intended that
  92.                 modification of the RigidDiskBlock, or of any
  93.                 of the blocks pointed to by it, by another
  94.                 initiator (other than the one specified here)
  95.                 be allowed only after a suitable warning.  The
  96.                 user is then expected to perform an audio
  97.                 lock out ("Hey, is anyone else setting up SCSI
  98.                 stuff on this bus?").  The rdb_HostID may
  99.                 become something other than the initiator ID
  100.                 when connected to a real network: that is an
  101.                 area for future standardization.
  102.     rdb_BlockBytes        size of disk blocks
  103.                 This must be 512 for a disk with any
  104.                 AmigaDOS partitions on it.
  105.     rdb_Flags        longword of flags
  106.         RDBF._LAST            no disks exist to be configured after this
  107.                     one on this controller.
  108.         RDBF._LASTLUN        no LUNs exist to be configured greater
  109.                     than this one at this SCSI Target ID
  110.         RDBF._LASTTID        no Target IDs exist to be configured
  111.                     greater than this one on this SCSI bus
  112.         RDBF._DISKID        rdb_Disk... identification variables below
  113.                     contain valid data.
  114.         RDBF._CTRLRID        rdb_Controller... identification variables
  115.                     below contain valid data.
  116.  
  117.         These fields point to other blocks on the disk which are not
  118.         a part of any filesystem.
  119.  
  120.     rdb_BadBlockList    optional bad block list
  121.                 A singly linked list of blocks of type
  122.                 PartitionBlock
  123.     rdb_PartitionList    optional first partition block
  124.                 A singly linked list of blocks of type
  125.                 PartitionBlock
  126.     rdb_FileSysHeaderList    optional file system header block
  127.                 A singly linked list of blocks of type
  128.                 FileSysHeaderBlock
  129.     rdb_DriveInit        optional drive-specific init code
  130.                 A songly linked list of blocks of type
  131.                 LoadSegBlock containing initialization code.
  132.                 Called as DriveInit(lun,rdb,ior)(d0/a0/a1).
  133.     rdb_Reserved1        set to $ffffffffs
  134.                 These are reserved for future block lists.
  135.                 Since NULL for block lists is $ffffffff, these
  136.                 reserved entries must be set to $ffffffff.
  137.  
  138.         These fields describe the physical layout of the drive.
  139.  
  140.     rdb_Cylinders        number of drive cylinders
  141.     rdb_Sectors        sectors per track
  142.     rdb_Heads        number of drive heads
  143.     rdb_Interleave        interleave
  144.                 This drive interleave is independent from, and
  145.                 unknown to, the DOS's understanding of
  146.                 interleave as set in the partition's
  147.                 environment vector.
  148.     rdb_Park        landing zone cylinder
  149.     rdb_Reserved2        set to zeros
  150.  
  151.         These fields are intended for ST506 disks.  They are generally
  152.         unused for SCSI devices and set to zero.
  153.  
  154.     rdb_WritePreComp    starting cylinder: write precompensation
  155.     rdb_ReducedWrite    starting cylinder: reduced write current
  156.     rdb_StepRate        drive step rate
  157.     rdb_Reserved3        set to zeros
  158.  
  159.         These fields are used while partitions are set up to constrain
  160.         the partitionable area and help describe the relationship
  161.         between the drive's logical and physical layout. 
  162.  
  163.     rdb_RDBlocksLo        low block of the range allocated for
  164.                 blocks described here.  Replacement blocks
  165.                 for bad blocks may also live in this range.
  166.     rdb_RDBlocksHi        high block of this range (inclusive)
  167.     rdb_LoCylinder        low cylinder of partitionable disk area
  168.                 Blocks described by this include file will
  169.                 generally be found in cylinders below this one.
  170.     rdb_HiCylinder        high cylinder of partitionable data area
  171.                 Usually rdb_Cylinders-1.
  172.     rdb_CylBlocks        number of blocks available per cylinder
  173.                 This may be rdb_Sectors*rdb_Heads, but a SCSI
  174.                 disk that reserves one block per cylinder for
  175.                 bad block mapping uses rdb_Sectors*rdb_Heads-1.
  176.     rdb_AutoParkSeconds    The number of seconds to wait before parking
  177.                 drive heads automatically.  If zero, this
  178.                 feature is not desired.
  179.     rdb_Reserved4        set to zeros
  180.  
  181.         These fields are of the form available from a SCSI Identify
  182.         command.  Their purpose is to help the user identify the
  183.         disk during setup.  Entries exist for both controller and
  184.         disk for non-embedded SCSI disks.
  185.  
  186.     rdb_DiskVendor        The vendor name of the disk
  187.     rdb_DiskProduct        The product name of the disk
  188.     rdb_DiskRevision    The revision code of the disk
  189.     rdb_ControllerVendor    The vendor name of the disk controller
  190.     rdb_ControllerProduct    The product name of the disk controller
  191.     rdb_ControllerRevision    The revision code of the disk controller
  192.     rdb_Reserved5
  193.  
  194.     BadBlockBlock
  195.         The end of data occurs when bbb_Next is null ($ffffffff), and
  196.         the summed data is exhausted.
  197.  
  198.     bbb_ID            == 'BADB'
  199.     bbb_SummedLongs        size of this checksummed structure
  200.                 Note that this is not 64 like most of the other
  201.                 structures.  This is the number of valid longs
  202.                 in this image, and can be from 6 to
  203.                 rdb_BlockBytes/4.  The latter is the best size
  204.                 for all intermediate blocks.
  205.     bbb_ChkSum        block checksum (longword sum to zero)
  206.     bbb_HostID        SCSI Target ID of host
  207.                 This describes the initiator ID for the creator
  208.                 of these blocks.  (see the rdb_HostID
  209.                 discussion)
  210.     bbb_Next        block number of the next BadBlockBlock
  211.     bbb_Reserved
  212.     bbb_BlockPairs        pairs of block remapping information
  213.                 The data starts here and continues as long as
  214.                 indicated by bbb_SummedLongs-6: e.g. if
  215.                 bbb_SummedLongs is 128 (512 bytes), 61 pairs
  216.                 are described here.
  217.  
  218.     PartitionBlock
  219.         Note that while reading these blocks you may encounter partitions
  220.         that are not to be mounted because the pb_HostID does not match,
  221.         or because the pb_DriveName is in use and no fallback strategy
  222.         exists, or because PBF._NOMOUNT is set.  They may be mounted but
  223.         not made bootable because PBF._BOOTABLE is not set.
  224.  
  225.     pb_ID            == 'PART'
  226.     pb_SummedLongs        == 64
  227.     pb_ChkSum        block checksum (longword sum to zero)
  228.     pb_HostID        SCSI Target ID of host
  229.                 This describes the initiator ID for the owner
  230.                 of this partition.  (see the rdb_HostID
  231.                 discussion)
  232.     pb_Next            block number of the next PartitionBlock
  233.     pb_Flags        see below for defines
  234.         PBF._BOOTABLE        this partition is intended to be bootable
  235.                     (e.g. expected directories and files exist)
  236.     pb_Reserved1
  237.  
  238.     pb_DevFlags        preferred flags for OpenDevice
  239.     pb_DriveName        preferred DOS device name: BSTR form
  240.                 This name is not to be used if it is already
  241.                 in use.
  242.  
  243.         pb_Reserved2 will always be at least 4 longwords so that
  244.         the ram image of this record may be converted to the parameter
  245.         packet to the expansion.library function MakeDosNode
  246.  
  247.     pb_Reserved2        filler to 32 longwords
  248.  
  249.         The specification of the location of the partition is one of
  250.         the components of the environment, below.  If possible,
  251.         describe the partition in a manner that tells the DOS about
  252.         the physical layout of the partition: specifically, where the
  253.         cylinder boundaries are.  This allows the DOS's smart block
  254.         allocation strategy to work.
  255.  
  256.     pb_Environment        environment vector for this partition
  257.         de_TableSize        size of Environment vector
  258.         de_SizeBlock        == 128
  259.         de_SecOrg            == 0
  260.         de_Surfaces            number of heads
  261.                     (see layout discussion above)
  262.         de_SectorPerBlock        == 1
  263.         de_BlocksPerTrack        blocks per track
  264.                     (see layout discussion above)
  265.         de_Reserved            DOS reserved blocks at start of partition.
  266.                     Must be >= 1.  2 is recommended.
  267.         de_PreAlloc            DOS reserved blocks at end of partition
  268.                     Valid only for filesystem type DOS^A (the
  269.                     fast file system).  Zero otherwise.
  270.         de_Interleave        DOS interleave
  271.                     Valid only for filesystem type DOS^@ (the
  272.                     old file system).  Zero otherwise.
  273.         de_LowCyl            starting cylinder
  274.         de_HighCyl            max cylinder
  275.         de_NumBuffers        initial # DOS of buffers. 
  276.         de_BufMemType        type of mem to allocate for buffers
  277.                     The second argument to AllocMem().
  278.         de_MaxTransfer        max number of bytes to transfer at a time
  279.         de_Mask            address mask to block out certain memory
  280.                     $00ffffff for DMA devices.
  281.         de_BootPri            Boot priority for autoboot
  282.                     Suggested value: zero.  Keep less than
  283.                     five, so it won't override a boot floppy.
  284.         de_DosType            ASCII string showing filesystem type;
  285.                     DOS^@ ($444F5300) is old filesystem,
  286.                     DOS^A ($444F5301) is fast file system.
  287.     pb_EReserved        reserved for future environment vector
  288.  
  289.     FileSysHeaderBlock
  290.     fhb_ID            == 'FSHD'
  291.     fhb_SummedLongs        == 64
  292.     fhb_ChkSum        block checksum (longword sum to zero)
  293.     fhb_HostID        SCSI Target ID of host
  294.                 This describes the initiator ID for the creator
  295.                 of this block.  (see the rdb_HostID
  296.                 discussion)
  297.     fhb_Next        block number of next FileSysHeaderBlock
  298.     fhb_Flags        see below for defines
  299.     fhb_Reserved1
  300.  
  301.         The following information is used to construct a FileSysEntry
  302.         node in the FileSystem.resource.
  303.  
  304.     fhb_DosType        file system description
  305.                 This is matched with a partition environment's
  306.                 de_DosType entry.
  307.     fhb_Version        release version of this load image
  308.                 Usually MSW is version, LSW is revision.
  309.     fhb_PatchFlags        patch flags
  310.                 These are bits set for those of the following
  311.                 that need to be substituted into a standard
  312.                 device node for this file system, lsb first:
  313.                 e.g. 0x180 to substitute SegList & GlobalVec
  314.     fhb_Type        device node type: zero
  315.     fhb_Task        standard dos "task" field: zero
  316.     fhb_Lock        not used for devices: zero
  317.     fhb_Handler        filename to loadseg: zero placeholder
  318.     fhb_StackSize        stacksize to use when starting task
  319.     fhb_Priority        task priority when starting task
  320.     fhb_Startup        startup msg: zero placeholder
  321.     fhb_SegListBlocks    first of linked list of LoadSegBlocks:
  322.                 Note that if the fhb_PatchFlags bit for this
  323.                 entry is set (bit 7), the blocks pointed to by
  324.                 this entry must be LoadSeg'd and the resulting
  325.                 BPTR put in the FileSysEntry node.
  326.     fhb_GlobalVec        BCPL global vector when starting task
  327.                 Zero or -1.
  328.     fhb_Reserved2        (those reserved by PatchFlags)
  329.  
  330.     fhb_Reserved3
  331.  
  332.  
  333.     LoadSegBlock
  334.         The end of data occurs when lsb_Next is null ($ffffffff), and
  335.         the summed data is exhausted.
  336.  
  337.     lsb_ID            == 'LSEG'
  338.     lsb_SummedLongs        size of this checksummed structure
  339.                 Note that this is not 64 like most of the other
  340.                 structures.  This is the number of valid longs
  341.                 in this image, like bbb_SummedLongs.
  342.     lsb_ChkSum        block checksum (longword sum to zero)
  343.     lsb_HostID        SCSI Target ID of host
  344.                 This describes the initiator ID for the creator
  345.                 of these blocks.  (see the rdb_HostID
  346.                 discussion)
  347.     lsb_Next        block number of the next LoadSegBlock
  348.     lsb_LoadData        data for "loadseg"
  349.                 The data starts here and continues as long as
  350.                 indicated by lsb_SummedLongs-5: e.g. if
  351.                 lsb_SummedLongs is 128 (512 bytes), 123 longs
  352.                 of data are valid here.
  353.  
  354. filesysres.[hi]
  355.  
  356.         The FileSysResource is created by the first code that needs to
  357.         use it.  It is added to the resource list for others to use.
  358.         (Checking and creation should be performed while Forbid()).
  359.  
  360.     FileSysResource
  361.     fsr_Node        on resource list
  362.     fsr_Creator        name of creator of this resource
  363.     fsr_FileSysEntries    list of FileSysEntry structs
  364.  
  365.     FileSysEntry
  366.     fse_Node        on fsr_FileSysEntries list
  367.                 ln_Name is of creator of this entry
  368.     fse_DosType        DosType of this FileSys
  369.     fse_Version        release version of this FileSys
  370.                 Usually MSW is version, LSW is revision.
  371.     fse_PatchFlags        bits set for those of the following that
  372.                 need to be substituted into a standard
  373.                 device node for this file system: e.g.
  374.                 $180 for substitute SegList & GlobalVec
  375.     fse_Type        device node type: zero
  376.     fse_Task        standard dos "task" field
  377.     fse_Lock        not used for devices: zero
  378.     fse_Handler        filename to loadseg (if SegList is null)
  379.     fse_StackSize        stacksize to use when starting task
  380.     fse_Priority        task priority when starting task
  381.     fse_Startup        startup msg: FileSysStartupMsg for disks
  382.     fse_SegList        segment of code to run to start new task
  383.     fse_GlobalVec        BCPL global vector when starting task
  384.  
  385.     no more entries need exist than those implied by fse_PatchFlags, so
  386.     entries do not have a fixed size.
  387.